home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / HENSA / MATHS / PLPLOT / PLPLOT.ZIP / include / pdf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-08  |  3.5 KB  |  113 lines

  1. /* $Id: pdf.h,v 1.9 1994/04/08 12:10:08 mjl Exp $
  2.    $Log: pdf.h,v $
  3.  * Revision 1.9  1994/04/08  12:10:08  mjl
  4.  * Moved unsigned type defines to this header file.
  5.  *
  6.  * Revision 1.8  1994/03/23  06:58:11  mjl
  7.  * Minor change to file wrapper to make consistent with rest of package.
  8.  *
  9.  * Revision 1.7  1994/02/07  23:02:38  mjl
  10.  * PLiodev struct defined.
  11.  *
  12.  * Revision 1.6  1994/01/15  17:33:16  mjl
  13.  * Added typedef of PDFstrm and wrapped function prototypes in a macro so
  14.  * the header can be read without problems by K&R compilers (cc).
  15. */
  16.  
  17. /*
  18.     pdf.h
  19.  
  20.     Copyright (C) 1992 by Maurice J. LeBrun
  21.  
  22.     Macros and prototypes for the PDF package.
  23.  
  24.     This software may be freely copied, modified and redistributed without
  25.     fee provided that this copyright notice is preserved intact on all
  26.     copies and modified copies. 
  27.  
  28.     There is no warranty or other guarantee of fitness of this software.
  29.     It is provided solely "as is". The author(s) disclaim(s) all
  30.     responsibility and liability with respect to this software's usage or
  31.     its effect upon hardware or computer systems. 
  32. */
  33.  
  34. #ifndef __PDF_H__
  35. #define __PDF_H__
  36.  
  37. /* Some unsigned types */
  38.  
  39. #ifndef U_CHAR
  40. #define U_CHAR unsigned char
  41. #endif
  42.  
  43. #ifndef U_SHORT
  44. #define U_SHORT unsigned short
  45. #endif
  46.  
  47. #ifndef U_INT
  48. #define U_INT unsigned int
  49. #endif
  50.  
  51. #ifndef U_LONG
  52. #define U_LONG unsigned long
  53. #endif
  54.  
  55. /* PDFstrm definition */
  56. /* The low level PDF i/o routines use the transfer method appropriate for */
  57. /* the first non-null type below */
  58.  
  59. typedef struct {
  60.     FILE *file;                /* Filesystem */
  61.     unsigned char *buffer;        /* Memory buffer */
  62.     long bp, bufmax;            /* Buffer pointer and max size */
  63. } PDFstrm;
  64.  
  65. /* Info for the i/o device.  Only used by Tcl/TK/dp drivers for now */
  66.  
  67. typedef struct {
  68.     int   fd;                /* I/O device file descriptor */
  69.     FILE  *file;            /* File handle */
  70.     char  *filename;            /* Fifo or socket name (if needed) */
  71.     char  *filehandle;            /* Handle for use from interpreter */
  72.     int   type;                /* Communication channel type */
  73.     char  *typename;            /* As above, but in string form */
  74. } PLiodev;
  75.  
  76. /* Error numbers */
  77.  
  78. #define PDF_ERROR        1    /* Unknown error    */
  79. #define PDF_FNOPEN        2    /* File not open    */
  80. #define PDF_FAOPEN        3    /* File already open    */
  81. #define PDF_BADUN        4    /* Bad unit number    */
  82. #define PDF_BADNBITS        5    /* Invalid # of bits    */
  83. #define PDF_RDERR        6    /* Read error        */
  84. #define PDF_WRERR        7    /* Write error        */
  85. #define PDF_NOTPDF        8    /* Not a valid PDF file */
  86.  
  87. /* Prototypes */
  88. /* Use a wrapper for the prototypes for use from cc */
  89.  
  90. PDFstrm *pdf_fopen    PLARGS((char *filename, char *mode));
  91. PDFstrm *pdf_bopen    PLARGS((U_CHAR *buffer, long bufmax));
  92. PDFstrm *pdf_finit    PLARGS((FILE *file));
  93. int  pdf_close        PLARGS((PDFstrm *pdfs));
  94.  
  95. int  pdf_putc        PLARGS((int c, PDFstrm *pdfs));
  96. int  pdf_getc        PLARGS((PDFstrm *pdfs));
  97. int  pdf_ungetc        PLARGS((int c, PDFstrm *pdfs));
  98.  
  99. int  pdf_rd_header    PLARGS((PDFstrm *pdfs, char *header));
  100. int  pdf_wr_header    PLARGS((PDFstrm *pdfs, char *header));
  101. int  pdf_wr_1byte    PLARGS((PDFstrm *pdfs, U_CHAR s));
  102. int  pdf_rd_1byte    PLARGS((PDFstrm *pdfs, U_CHAR *ps));
  103. int  pdf_wr_2bytes    PLARGS((PDFstrm *pdfs, U_SHORT s));
  104. int  pdf_rd_2bytes     PLARGS((PDFstrm *pdfs, U_SHORT *ps));
  105. int  pdf_wr_2nbytes    PLARGS((PDFstrm *pdfs, U_SHORT *s, PLINT n));
  106. int  pdf_rd_2nbytes     PLARGS((PDFstrm *pdfs, U_SHORT *s, PLINT n));
  107. int  pdf_wr_4bytes    PLARGS((PDFstrm *pdfs, U_LONG s));
  108. int  pdf_rd_4bytes     PLARGS((PDFstrm *pdfs, U_LONG *ps));
  109. int  pdf_wr_ieeef    PLARGS((PDFstrm *pdfs, float f));
  110. int  pdf_rd_ieeef    PLARGS((PDFstrm *pdfs, float *pf));
  111.  
  112. #endif    /* __PDF_H__ */
  113.